package com.crazymakercircle.dhptester.command;

import com.crazymakercircle.dhptester.distributed.TaskManger;
import lombok.Data;
import org.springframework.stereotype.Service;

import java.util.Scanner;

@Data
@Service("TestCaseUploadCommand")
public class TestCaseUploadCommand implements BaseCommand
{

    private String filePath;
    public static final String KEY = "1";

    @Override
    public void exec(Scanner scanner)
    {
        System.out.print("please input JSON case path：");
        while (true)
        {
            filePath = scanner.next();
            if (filePath.trim().length() <= 1)
            {
                System.out.println("path is error ,please input again !");
            } else
            {
                TaskManger.getInstance().uploadTestCase(filePath);
                break;
            }
        }
    }


    @Override
    public String getKey()
    {
        return KEY;
    }

    @Override
    public String getTip()
    {
        return "upload test case";
    }

}
